# -*- coding: utf-8 -*-
"""
Created on Tue Jul 16 21:16:16 2024

@author: LoongFly
"""
import cv2
import numpy as np

o = cv2.imread("A4_ImageGradient\\egde.png",cv2.IMREAD_UNCHANGED)
scharrx = cv2.Scharr(o, cv2.CV_64F, 1, 0)
scharrx = cv2.convertScaleAbs(scharrx)
scharry = cv2.Scharr(o, cv2.CV_64F, 0, 1)
scharry = cv2.convertScaleAbs(scharry)

result = cv2.addWeighted(scharrx, 0.5, scharry, 0.5, 0)

cv2.imshow("Original", o)
cv2.imshow("Scharr X", scharrx)
cv2.imshow("Scharr Y", scharry)
cv2.imshow("Result", result)

cv2.waitKey(0)
cv2.destroyAllWindows()
